package com.enation.app.shop.front.policyInsurance.appController.InPolicyUtils;

import com.enation.app.shop.front.api.inpolicy.entity.InPolicy;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 保单  帮助类
 */
public class InsPolicyUtils {
    /**
     * 养殖端保单简要信息
     * @param inPolicyList
     * @return
     */
    public static List chageFrameStatus(List<InPolicy> inPolicyList) {
        List list = new ArrayList();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
        for (int i = 0; i < inPolicyList.size(); i++) {
            Map<String, Object> instanceMap = new HashMap<String, Object>();
            instanceMap.put("year", sdf.format(inPolicyList.get(i).getBegin_time()));
            instanceMap.put("begin_time", inPolicyList.get(i).getBegin_time());
            instanceMap.put("warranty_id", inPolicyList.get(i).getWarranty_id());
            instanceMap.put("warranty_number", inPolicyList.get(i).getWarranty_number());
            instanceMap.put("item", inPolicyList.get(i).getItem());
            instanceMap.put("insured_quantity", inPolicyList.get(i).getInsured_quantity());
            instanceMap.put("end_time", inPolicyList.get(i).getEnd_time());
            instanceMap.put("receiver_name", inPolicyList.get(i).getReceiver_name());
            if (inPolicyList.get(i).getStatus() == 0) {
                instanceMap.put("status", 0);
            }
            if (inPolicyList.get(i).getStatus() == 1) {
                instanceMap.put("status", 1);
            }
            if (inPolicyList.get(i).getStatus() == 2) {
                instanceMap.put("status", 2);
            }
            if (inPolicyList.get(i).getStatus() == 3) {
                instanceMap.put("status", 3);
            }
            if (inPolicyList.get(i).getStatus() == 4) {
                instanceMap.put("status", 4);
            }
            if (inPolicyList.get(i).getStatus() == 5) {
                instanceMap.put("status", 5);
            }
            if (inPolicyList.get(i).getStatus() == 6) {
                instanceMap.put("status", 6);
            }
            list.add(instanceMap);

        }

        return list;
    }


        public static List chageInPolicyStatus (List < InPolicy > inPolicyList) {
        List list = new ArrayList();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
            for (InPolicy inPolicy : inPolicyList) {
                Map instanceMap = new HashMap();
                instanceMap.put("year", sdf.format(inPolicy.getBegin_time()));
                instanceMap.put("unit", inPolicy.getUnit());
                instanceMap.put("breeding_farm_azimuth", inPolicy.getBreeding_farm_azimuth());
                instanceMap.put("insured_quantity", inPolicy.getInsured_quantity());
                instanceMap.put("warranty_id", inPolicy.getWarranty_id());
                instanceMap.put("receiver_name", inPolicy.getReceiver_name());
                instanceMap.put("warranty_number", inPolicy.getWarranty_number());
                instanceMap.put("insurant_name", inPolicy.getInsurant_name());
                instanceMap.put("policy_mobile", inPolicy.getPolicy_mobile());
                instanceMap.put("item", inPolicy.getItem());
                instanceMap.put("begin_time", inPolicy.getBegin_time());
                instanceMap.put("end_time", inPolicy.getEnd_time());
                instanceMap.put("apply_method", inPolicy.getApply_method());
                if (inPolicy.getStatus() == 0) {
                    instanceMap.put("status", 0);
                }
                if (inPolicy.getStatus() == 1) {
                    instanceMap.put("status", 1);
                }
                if (inPolicy.getStatus() == 2) {
                    instanceMap.put("status", 2);
                }
                if (inPolicy.getStatus() == 3) {
                    instanceMap.put("status", 3);
                }
                if (inPolicy.getStatus() == 4) {
                    instanceMap.put("status", 4);
                }
                if (inPolicy.getStatus() == 5) {
                    instanceMap.put("status", 5);
                }
                if (inPolicy.getStatus() == 6) {
                    instanceMap.put("status", 6);
                }
                list.add(instanceMap);
            }
            return list;
        }
}
